<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-row layui-col-space5">
                <div class="layui-col-md3">
                    <div class="layui-card-header">标签组</div>
                    <table class="layui-hide"  id="left-table" lay-filter="left-table"></table>
                </div>
                <div class="layui-col-md9">
                    <div class="layui-card-header">标签管理</div>
                    <table class="layui-hide"  id="main-table" lay-filter="main-table"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:inline="none"></script>
<script>
    layui.use(['table','form','element'], function(){
        var table = layui.table,
            element = layui.element,
            form = layui.form;
        table.render({
            elem: '#left-table'
            ,height: (top.height-85)+'px'
            ,url: 'tagGroup/getPageList'
            ,title: '标签组列表'
            ,page: true
            ,cols: [
                [
                    {field: 'name', title: "组名",width:280}
                ]
            ]
        });
        table.on('row(left-table)', function(obj){
            // clickLayTableRow(table,form,'left-table',obj);
            table.reload("main-table",{where:{groupId:obj.data.id}});
        });
        table.render({
            elem: '#main-table'
            ,height: (top.height-85)+'px'
            ,url: 'tag/getPageList'
            ,title: '标签列表'
            ,page: true
            ,cols: [
                [
                    {type: 'checkbox'},
                    {type: 'numbers'}
                    ,{field: 'id', title: "ID",hide:true,width:180}
                    ,{field: 'name', title: "标签名称",width:280}
                ]
            ]
            ,done:function(){
                enableRowClick(table,form,'main-table',"main-table");
            }
        });


        window.getIds = function (){
            var checkStatus = table.checkStatus('main-table');
            let data = checkStatus.data;
            let ids = [];
            for(var i=0;i<data.length;i++){
                ids.push({id:data[i].id,name:data[i].name});
            }
            return ids;
        }


    });


</script>
<script type="text/html" id="rowtools">
    <a class="layui-btn layui-btn-xs" lay-event="select">选择</a>
</script>
</body>
</html>